/**
*      author: Y_Yao
*      created: 2025-04-18 14:25:48
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
const int N = 3e3 + 7;
int n;
pair<int,string> a[N];//first是a
int ans[N];
bool vis[N];

void solve()
{
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i].second >> a[i].first;
    }
    sort(a + 1,a + n + 1);

    for(int i = n;i >= 1;i--)
    {
        if(a[i].first >= i)
        {
            cout << -1 << endl;
            return;
        }

        for(int j = n - a[i].first;j >= 0;j--)
        {
            if(!vis[j])
            {
                ans[i] = j;
                vis[j] = true;
                break;
            }
        }
    }
    for(int i = 1;i <= n;i++)
    {
        cout << a[i].second << " " << ans[i] << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    // cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}